package Demo1;

public class Test {
    public static void test1(Animal animal){
        animal.eat();
    }
    public static void test2(IFlying flying){
        flying.fly();
    }
    public static void test3(IRunning running){
        running.run();
    }
    public static void test4(ISwimming swimming){
        swimming.swim();
    }
    public static void main(String[] args) {
            Bird bird = new Bird("小鸟",4);
            Dog dog = new Dog("小狗",3);
            test1(bird);
            test1(dog);
            test2(bird);
            test3(dog);
            test3(bird);
            test4(dog);
            test3(new Robot());//只要实现了这个接口就可以用
    }
}

